package com.travel.bootmall.controller;

import com.travel.bootmall.bean.User;
import com.travel.bootmall.dao.UserDao;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Auther: yjw
 * @Date: 2020/04/11/21:10
 * @Description:
 */
@RestController
public class checkcontroller {
    @Autowired
    UserDao userDao;
    @RequestMapping("/checkname")
    public String checkName(String name){
        System.out.println("进入");
        String msg = "";
        User user = userDao.findByName(name);
        if (name == null){
            msg = "用户名不可为空";
        }else if(user != null){
            msg = "用户名已被注册";
        }else {
            msg = "ok";
        }
        return msg;
    }
}
